<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/include/taglib.jsp"%>
<%@ page import="java.sql.*"%>
<%
	//连接数据库
	String driverName = "com.mysql.jdbc.Driver"; //Mysql数据库连接
	String userName = "root";
	String psw = "123456"; //本行和上一行是数据库的登录名和密码
	String dbName = "test1"; //数据库名字
	String url = "jdbc:mysql://localhost:3306/test1?serverTimezone=UTC";
	Class.forName("com.mysql.jdbc.Driver");
	Connection conn = DriverManager.getConnection(url, userName, psw);
	Statement stmt = conn.createStatement();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"xmlns:th="http://www.thymeleaf.com">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css"  media="all" th:href="@{/${ctx}/layui/css/layui.css}">
<script>
	var ctx = "${ctx}";
</script>
</head>
<body>
	<form class="layui-form" style="width: 80%;" id="arf">
		<!-- 管理员id -->
		<input type="hidden" name="productId" value="${product.productId }"
			id="id" />
		<div class="layui-form-item">
			<label class="layui-form-label">产品名称</label>
			<div class="layui-input-block">
				<input type="text" id="productName" class="layui-input"
					name="productName" value="${product.productName }">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">产品分类</label>
			<div class="layui-input-block">
				<select name="classificationId" id="classificationId"
					class="layui-input">
					<option value="${product.classificationId }">${product.classificationId }</option>
					<%
						ResultSet rs = stmt.executeQuery("SELECT classification.classification_id FROM classification");
						while (rs.next()) //循环输出数据
						{
							out.print("<option value=" + rs.getString(1) + ">" + rs.getString(1) + "</option>");
						}
					%>
					<!-- <option value="彩妆">彩妆</option>
			<option value="品牌箱包">品牌箱包</option>
			<option value="鞋履">鞋履</option>
			<option value="女士穿搭">女士穿搭</option>
			<option value="男士护肤">男士护肤	</option>
			<option value="内衣">内衣</option>
			<option value="品质男装">品质男装</option>
			<option value="运动">运动</option>
			<option value="钟表配饰">钟表配饰</option>
			<option value="居家">居家</option>
			<option value="食品保健">食品保健</option>
			<option value="母婴">母婴</option>
			<option value="数码家电">数码家电</option>
			<option value="护肤">护肤</option> -->
				</select>
				<%-- <input type="text" id="classificationId" class="layui-input"
					name="classificationId"
					value="${product.classificationId }"> --%>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">产品品牌</label>
			<div class="layui-input-block">
				<input type="text" id="productBrand" class="layui-input"
					name="productBrand" value="${product.productBrand }">
			</div>
		</div>
		<div class="layui-form-item layui-form-text"" >
			<label class="layui-form-label">产品介绍</label>
			<div class="layui-input-block">
<textarea class="layui-textarea" name="productIntroduction" id="productIntroduction" placeholder="请输入内容" >${product.productIntroduction}</textarea>
			<!-- 	<textarea class="layui-textarea" id="productIntroduction"
					style="display: none" name="productIntroduction">  
		
				</textarea> -->
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">产品库存</label>
			<div class="layui-input-block">
				<input type="text" id="productInventory" class="layui-input"
					name="productInventory" value="${product.productInventory }">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">产品价格</label>
			<div class="layui-input-block">
				<input type="text" id="productPrice" class="layui-input"
					name="productPrice" value="${product.productPrice }">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">推荐位置</label>
			<div class="layui-input-block">
				<%-- <input type="text" id="recommendPosition" class="layui-input"
					name="recommendPosition" value="${product.recommendPosition }"> --%>
					<select name="recommendPosition" id="recommendPosition"
						class="layui-input search_input">
						<option value="${product.recommendPosition }">${product.recommendPosition }</option>
						 <%

     				ResultSet rs1=stmt.executeQuery("SELECT DISTINCT product.recommend_position FROM product");
     				while(rs1.next())   //循环输出数据
     				{
          				out.print("<option value="+rs1.getString(1)+">"+rs1.getString(1)+"</option>");
     				}
				%> 
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="updateProduct">立即保存</button>
			</div>
		</div>
	</form>
	<script>
		layui.use('layedit', function() {
			var layedit = layui.layedit, $ = layui.jquery;

			//构建一个默认的编辑器
			var editIndex = layedit.build('productIntroduction');

			//编辑器外部操作

			//自定义工具栏

		});
	</script>

	<script type="text/javascript" src="${ctx }/layui/layui.js"></script>
	<script type="text/javascript" src="${ctx }/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${ctx }/js/product/editProduct.js"></script>
</body>
</html>